<!DOCTYPE html>
<html lang="en-US">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>el-cascader-new | vue3-element-dict</title>
    <meta name="generator" content="VuePress 1.9.7">
    <link rel="icon" href="/vue3-element-dict/favicon.ico">
    <script defer="defer" async="async" src="https://cpro.baidustatic.com/cpro/ui/cm.js"></script>
    <meta name="description" content="vue3-element-dict字典包官方使用文档">
    
    <link rel="preload" href="/vue3-element-dict/assets/css/0.styles.91c1c7f1.css" as="style"><link rel="preload" href="/vue3-element-dict/assets/js/app.cc2330b0.js" as="script"><link rel="preload" href="/vue3-element-dict/assets/js/4.8b8692cb.js" as="script"><link rel="preload" href="/vue3-element-dict/assets/js/15.37952899.js" as="script"><link rel="prefetch" href="/vue3-element-dict/assets/js/1.9df3603b.js"><link rel="prefetch" href="/vue3-element-dict/assets/js/10.55ebc9f1.js"><link rel="prefetch" href="/vue3-element-dict/assets/js/11.ae1602ab.js"><link rel="prefetch" href="/vue3-element-dict/assets/js/12.7a6d05ba.js"><link rel="prefetch" href="/vue3-element-dict/assets/js/13.1d9a30ea.js"><link rel="prefetch" href="/vue3-element-dict/assets/js/14.e190b104.js"><link rel="prefetch" href="/vue3-element-dict/assets/js/16.3e7761b4.js"><link rel="prefetch" href="/vue3-element-dict/assets/js/17.47706849.js"><link rel="prefetch" href="/vue3-element-dict/assets/js/18.2ca9e3cb.js"><link rel="prefetch" href="/vue3-element-dict/assets/js/19.6d920865.js"><link rel="prefetch" href="/vue3-element-dict/assets/js/2.eb833b2e.js"><link rel="prefetch" href="/vue3-element-dict/assets/js/20.9e827313.js"><link rel="prefetch" href="/vue3-element-dict/assets/js/21.761e0c92.js"><link rel="prefetch" href="/vue3-element-dict/assets/js/22.46503405.js"><link rel="prefetch" href="/vue3-element-dict/assets/js/23.2445e7a2.js"><link rel="prefetch" href="/vue3-element-dict/assets/js/24.f387e397.js"><link rel="prefetch" href="/vue3-element-dict/assets/js/25.483511e8.js"><link rel="prefetch" href="/vue3-element-dict/assets/js/26.ad2f64f8.js"><link rel="prefetch" href="/vue3-element-dict/assets/js/27.5bc6f38e.js"><link rel="prefetch" href="/vue3-element-dict/assets/js/28.c5d10c33.js"><link rel="prefetch" href="/vue3-element-dict/assets/js/29.fa663539.js"><link rel="prefetch" href="/vue3-element-dict/assets/js/30.7a1bf955.js"><link rel="prefetch" href="/vue3-element-dict/assets/js/31.9ff79c48.js"><link rel="prefetch" href="/vue3-element-dict/assets/js/32.649b936d.js"><link rel="prefetch" href="/vue3-element-dict/assets/js/33.876fa051.js"><link rel="prefetch" href="/vue3-element-dict/assets/js/34.5b3fd678.js"><link rel="prefetch" href="/vue3-element-dict/assets/js/35.e61ee13e.js"><link rel="prefetch" href="/vue3-element-dict/assets/js/36.5ee9c11f.js"><link rel="prefetch" href="/vue3-element-dict/assets/js/37.47b949b4.js"><link rel="prefetch" href="/vue3-element-dict/assets/js/38.70886628.js"><link rel="prefetch" href="/vue3-element-dict/assets/js/5.a10e50db.js"><link rel="prefetch" href="/vue3-element-dict/assets/js/6.10b21df8.js"><link rel="prefetch" href="/vue3-element-dict/assets/js/7.d3139522.js"><link rel="prefetch" href="/vue3-element-dict/assets/js/8.f1b6d00e.js"><link rel="prefetch" href="/vue3-element-dict/assets/js/9.4f54a1f3.js">
    <link rel="stylesheet" href="/vue3-element-dict/assets/css/0.styles.91c1c7f1.css">
  </head>
  <body>
    <div id="app" data-server-rendered="true"><div class="theme-container"><header class="navbar"><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/vue3-element-dict/" class="home-link router-link-active"><!----> <span class="site-name">vue3-element-dict</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/vue3-element-dict/" class="nav-link">
  主页
</a></div><div class="nav-item"><a href="/vue3-element-dict/guide/" class="nav-link">
  指南
</a></div><div class="nav-item"><a href="https://www.npmjs.com/package/vue3-element-dict" target="_blank" rel="noopener noreferrer" class="nav-link external">
  npm地址
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></div> <!----></nav></div></header> <div class="sidebar-mask"></div> <aside class="sidebar"><nav class="nav-links"><div class="nav-item"><a href="/vue3-element-dict/" class="nav-link">
  主页
</a></div><div class="nav-item"><a href="/vue3-element-dict/guide/" class="nav-link">
  指南
</a></div><div class="nav-item"><a href="https://www.npmjs.com/package/vue3-element-dict" target="_blank" rel="noopener noreferrer" class="nav-link external">
  npm地址
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></div> <!----></nav>  <ul class="sidebar-links"><li><section class="sidebar-group depth-0"><p class="sidebar-heading"><span>指南</span> <!----></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/vue3-element-dict/guide/" class="sidebar-link">介绍</a></li><li><a href="/vue3-element-dict/guide/fast/" class="sidebar-link">快速开始</a></li><li><a href="/vue3-element-dict/guide/directory-structure/" class="sidebar-link">目录结构</a></li><li><a href="/vue3-element-dict/guide/config/" class="sidebar-link">字典包配置</a></li></ul></section></li><li><section class="sidebar-group depth-0"><p class="sidebar-heading"><span>普通字典组件</span> <!----></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/vue3-element-dict/components/el-select-dict/" class="sidebar-link">select-dict选择器</a></li><li><a href="/vue3-element-dict/components/el-radio-dict/" class="sidebar-link">radio-dict单选框</a></li><li><a href="/vue3-element-dict/components/el-checkbox-dict/" class="sidebar-link">checkbox-dict多选框</a></li><li><a href="/vue3-element-dict/components/el-radio-button-dict/" class="sidebar-link">radio-button-dict单选框</a></li><li><a href="/vue3-element-dict/components/el-checkbox-button-dict/" class="sidebar-link">checkbox-button-dict多选框</a></li><li><a href="/vue3-element-dict/components/el-tabs-dict/" class="sidebar-link">tabs-dict标签页</a></li><li><a href="/vue3-element-dict/components/el-tag-dict/" class="sidebar-link">tag-dict标签</a></li><li><a href="/vue3-element-dict/components/el-link-dict/" class="sidebar-link">link-dict链接</a></li><li><a href="/vue3-element-dict/components/el-button-dict/" class="sidebar-link">button-dict链接</a></li><li><a href="/vue3-element-dict/components/el-table-colmun-dict/" class="sidebar-link">el-table-colmun-dict表格</a></li></ul></section></li><li><section class="sidebar-group depth-0"><p class="sidebar-heading"><span>树形字典组件</span> <!----></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/vue3-element-dict/components/el-cascader-dict/" class="sidebar-link">cascader-dict联级选项</a></li><li><a href="/vue3-element-dict/components/el-tree-dict/" class="sidebar-link">tree-dict树菜单</a></li></ul></section></li><li><section class="sidebar-group depth-0"><p class="sidebar-heading open"><span>其他组件</span> <!----></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/vue3-element-dict/components/el-cascader-new/" aria-current="page" class="active sidebar-link">cascader-new联级选项</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/vue3-element-dict/components/el-cascader-new/#el-cascader-new-attribute" class="sidebar-link">el-cascader-new attribute</a></li><li class="sidebar-sub-header"><a href="/vue3-element-dict/components/el-cascader-new/#settings属性配置表" class="sidebar-link">settings属性配置表</a></li><li class="sidebar-sub-header"><a href="/vue3-element-dict/components/el-cascader-new/#新增方法" class="sidebar-link">新增方法</a></li><li class="sidebar-sub-header"><a href="/vue3-element-dict/components/el-cascader-new/#兼容ie样式问题" class="sidebar-link">兼容ie样式问题</a></li></ul></li><li><a href="/vue3-element-dict/components/el-tree-new/" class="sidebar-link">tree-new树菜单</a></li></ul></section></li><li><section class="sidebar-group depth-0"><p class="sidebar-heading"><span>过滤器</span> <!----></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/vue3-element-dict/filters/dict/" class="sidebar-link">字典过滤器</a></li><li><a href="/vue3-element-dict/filters/tree-dict/" class="sidebar-link">树形字典过滤器</a></li><li><a href="/vue3-element-dict/filters/other/" class="sidebar-link">其他过滤器</a></li></ul></section></li><li><section class="sidebar-group depth-0"><p class="sidebar-heading"><span>方法</span> <!----></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/vue3-element-dict/functions/dict/" class="sidebar-link">字典方法</a></li><li><a href="/vue3-element-dict/functions/tree-dict/" class="sidebar-link">树形字典方法</a></li><li><a href="/vue3-element-dict/functions/other/" class="sidebar-link">其他方法</a></li></ul></section></li></ul> </aside> <main class="page"> <div class="theme-default-content content__default"><h1 id="el-cascader-new"><a href="#el-cascader-new" class="header-anchor">#</a> el-cascader-new</h1> <p>基于原生el-cascader升级组件</p> <ol><li>解决原生组件点击选项不会选中且不会关闭下拉选项问题</li> <li>新增限制层级功能</li> <li>解决children为空数组时还会展示的bug</li> <li>新增配置去除某项的功能</li> <li>此组件接收element所有属性，props与options属性分别替换为 settings 和 data属性</li></ol> <h2 id="el-cascader-new-attribute"><a href="#el-cascader-new-attribute" class="header-anchor">#</a> el-cascader-new attribute</h2> <table><thead><tr><th>参数</th> <th>说明</th> <th>类型</th> <th>默认值</th></tr></thead> <tbody><tr><td>settings</td> <td>属性设置</td> <td>Object</td> <td>看后面具体参数配置</td></tr> <tr><td>data</td> <td>联级选项数据</td> <td>Array</td> <td>一些选项示例</td></tr> <tr><td>maxLevel</td> <td>限制到哪一层级（<strong>数据需要有层级标志</strong>）</td> <td>String</td> <td>“”</td></tr> <tr><td>delValue</td> <td>需要去除的部分选项，子级会一同去除</td> <td>String 或者 Array</td> <td>“”</td></tr> <tr><td>delChildren</td> <td>是否需要去除空 children</td> <td>Boolean</td> <td>false</td></tr> <tr><td>showLength</td> <td>是否展示子级数据量</td> <td>Boolean</td> <td>false</td></tr></tbody></table> <!----> <h2 id="settings属性配置表"><a href="#settings属性配置表" class="header-anchor">#</a> settings属性配置表</h2> <table><thead><tr><th>参数</th> <th>说明</th> <th>类型</th> <th>默认值</th></tr></thead> <tbody><tr><td>level</td> <td>限制层级的字段名</td> <td>String</td> <td>level</td></tr> <tr><td>value</td> <td>指定选项的值为选项对象的某个属性值</td> <td>String</td> <td>value</td></tr> <tr><td>label</td> <td>指定选项的值为选项对象的某个属性值</td> <td>String</td> <td>label</td></tr> <tr><td>children</td> <td>指定选项的值为选项对象的某个属性值</td> <td>String</td> <td>children</td></tr> <tr><td>leaf</td> <td>指定选项的叶子节点的标志位为选项对象的某个属性值</td> <td>String</td> <td>leaf</td></tr> <tr><td>expandTrigger</td> <td>次级菜单的展开方式，可选值 &quot;hover&quot; 与 ”click“</td> <td>String</td> <td>hover</td></tr> <tr><td>multiple</td> <td>是否多选</td> <td>Boolean</td> <td>false</td></tr> <tr><td>checkStrictly</td> <td>是否严格的遵守父子节点不互相关联</td> <td>Boolean</td> <td>true</td></tr> <tr><td>emitPath</td> <td>在选中节点改变时，是否返回由该节点所在的各级菜单的值所组成的数组，若设置 false，则只返回该节点的值</td> <td>Boolean</td> <td>false</td></tr> <tr><td>lazy</td> <td>是否动态加载子节点，需与 lazyLoad 方法结合使用</td> <td>Boolean</td> <td>false</td></tr> <tr><td>disabled</td> <td>指定选项的禁用为选项对象的某个属性值</td> <td>String</td> <td>disabled</td></tr></tbody></table> <h2 id="新增方法"><a href="#新增方法" class="header-anchor">#</a> 新增方法</h2> <table><thead><tr><th>方法名</th> <th>作用</th> <th>说明</th></tr></thead> <tbody><tr><td>getCascader</td> <td>返回el-cascader组件实例</td> <td>使用此方法后可调用el-cascader组件的方法</td></tr> <tr><td>getDataList</td> <td>返回树形数据的数组</td> <td>使用此方法可返回所有树形数据列表</td></tr> <tr><td>getDataMap</td> <td>返回数据map对象</td> <td>value: data</td></tr></tbody></table> <h2 id="兼容ie样式问题"><a href="#兼容ie样式问题" class="header-anchor">#</a> 兼容ie样式问题</h2> <div class="language-css extra-class"><pre class="language-css"><code><span class="token selector">.el-cascader__tags .el-tag&gt;span</span> <span class="token punctuation">{</span>
  <span class="token property">flex</span><span class="token punctuation">:</span> auto<span class="token punctuation">;</span>
<span class="token punctuation">}</span>
<span class="token selector">.el-cascader-menu__wrap</span><span class="token punctuation">{</span>
  <span class="token property">height</span><span class="token punctuation">:</span> 300px<span class="token punctuation">;</span>
<span class="token punctuation">}</span>
<span class="token selector">.el-cascader-node__label</span><span class="token punctuation">{</span>
  <span class="token property">flex</span><span class="token punctuation">:</span> none<span class="token punctuation">;</span>
<span class="token punctuation">}</span>
<span class="token selector">.el-cascader-node__postfix, .el-cascader-node__prefix</span> <span class="token punctuation">{</span>
  <span class="token property">top</span><span class="token punctuation">:</span> 50%<span class="token punctuation">;</span>
  <span class="token property">transform</span><span class="token punctuation">:</span> <span class="token function">translateY</span><span class="token punctuation">(</span>-50%<span class="token punctuation">)</span><span class="token punctuation">;</span>
  <span class="token property">line-height</span><span class="token punctuation">:</span> 4px<span class="token punctuation">;</span>
<span class="token punctuation">}</span>
</code></pre></div></div> <footer class="page-edit"><!----> <div class="last-updated"><span class="prefix">上次更新:</span> <span class="time">4/26/2023, 9:20:46 PM</span></div></footer> <div class="page-nav"><p class="inner"><span class="prev">
      ←
      <a href="/vue3-element-dict/components/el-tree-dict/" class="prev">
        tree-dict树菜单
      </a></span> <span class="next"><a href="/vue3-element-dict/components/el-tree-new/">
        tree-new树菜单
      </a>
      →
    </span></p></div> </main></div><div class="global-ui"><div id="loading-mask"><div class="loading-wrapper"><span class="loading-dot loading-dot-spin"><i></i> <i></i> <i></i> <i></i></span></div></div><!----></div></div>
    <script src="/vue3-element-dict/assets/js/app.cc2330b0.js" defer></script><script src="/vue3-element-dict/assets/js/4.8b8692cb.js" defer></script><script src="/vue3-element-dict/assets/js/15.37952899.js" defer></script>
  </body>
</html>
